package cn.icanci.ladybird.service.impl;

import cn.icanci.ladybird.pojo.entity.TicketDetailsTicketTimeMiddle;
import cn.icanci.ladybird.dao.TicketDetailsTicketTimeMiddleDao;
import cn.icanci.ladybird.service.TicketDetailsTicketTimeMiddleService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * (TicketDetailsTicketTimeMiddle)表服务实现类
 *
 * @author makejava
 * @since 2020-09-29 20:44:17
 */
@Service("ticketDetailsTicketTimeMiddleService")
public class TicketDetailsTicketTimeMiddleServiceImpl implements TicketDetailsTicketTimeMiddleService {
    @Resource
    private TicketDetailsTicketTimeMiddleDao ticketDetailsTicketTimeMiddleDao;

    /**
     * 通过ID查询单条数据
     *
     * @param ticketDetailsTicketTimeMiddleId 主键
     * @return 实例对象
     */
    @Override
    public TicketDetailsTicketTimeMiddle queryById(Long ticketDetailsTicketTimeMiddleId) {
        return this.ticketDetailsTicketTimeMiddleDao.queryById(ticketDetailsTicketTimeMiddleId);
    }

    /**
     * 查询多条数据
     *
     * @param offset 查询起始位置
     * @param limit  查询条数
     * @return 对象列表
     */
    @Override
    public List<TicketDetailsTicketTimeMiddle> queryAllByLimit(int offset, int limit) {
        return this.ticketDetailsTicketTimeMiddleDao.queryAllByLimit(offset, limit);
    }

    /**
     * 新增数据
     *
     * @param ticketDetailsTicketTimeMiddle 实例对象
     * @return 实例对象
     */
    @Override
    public TicketDetailsTicketTimeMiddle insert(TicketDetailsTicketTimeMiddle ticketDetailsTicketTimeMiddle) {
        this.ticketDetailsTicketTimeMiddleDao.insert(ticketDetailsTicketTimeMiddle);
        return ticketDetailsTicketTimeMiddle;
    }

    /**
     * 修改数据
     *
     * @param ticketDetailsTicketTimeMiddle 实例对象
     * @return 实例对象
     */
    @Override
    public TicketDetailsTicketTimeMiddle update(TicketDetailsTicketTimeMiddle ticketDetailsTicketTimeMiddle) {
        this.ticketDetailsTicketTimeMiddleDao.update(ticketDetailsTicketTimeMiddle);
        return this.queryById(ticketDetailsTicketTimeMiddle.getTicketDetailsTicketTimeMiddleId());
    }

    /**
     * 通过主键删除数据
     *
     * @param ticketDetailsTicketTimeMiddleId 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Long ticketDetailsTicketTimeMiddleId) {
        return this.ticketDetailsTicketTimeMiddleDao.deleteById(ticketDetailsTicketTimeMiddleId) > 0;
    }

    @Override
    public List<TicketDetailsTicketTimeMiddle> queryByTicketDetailsId(Long ticketDetailsId) {
        return this.ticketDetailsTicketTimeMiddleDao.queryByTicketDetailsId(ticketDetailsId);
    }
}